This guide explains how to build a TARDIS (Time And Relative Dimension In Space) using the CadQuery
Python library. This project covers all steps to create a visual representation of the iconic British blue police box.
To start, install CadQuery
by running:
pip install cadquery
For the best experience, use an IDE like Jupyter Notebook or a 3D viewer like cq-editor to visualize your model.
Start by importing CadQuery and defining the dimensions for scalability:
import cadquery as cq
# Define TARDIS dimensions
width = 100 # Width of the TARDIS base in mm
height = 200 # Total height
wall_thickness = 5 # Wall thickness
roof_height = 30 # Height of the roof section
door_height = 130 # Door height
window_height = 30 # Height of window sections
Using CadQuery, create a hollow square-shaped structure for the walls:
# Create the base shape of the TARDIS
base = cq.Workplane("XY").box(width, width, height - roof_height)
# Add wall thickness for depth
walls = base.faces(">Z").shell(-wall_thickness)
We’ll add small rectangular cutouts on each side for the windows and a larger one for the door.
window_width = 15
window_spacing = 5
# Create windows on the front face
windows = (
walls.faces(">Z")
.workplane(centerOption="CenterOfMass")
.rect(window_width, window_height, forConstruction=True)
.vertices().hole(wall_thickness / 2)
)
# Create a door shape in the front
door = (
windows.faces(">Z")
.workplane(centerOption="CenterOfMass")
.rect(width / 2, door_height)
.cutBlind(-wall_thickness)
)
To create a roof, add a pyramid shape with a central light fixture:
# Create the pyramid-shaped roof
roof = (
door.faces(">Z")
.workplane(centerOption="CenterOfMass")
.polyline([(width / 2, 0), (width / 4, roof_height), (-width / 2, 0)])
.close()
.extrude(wall_thickness)
)
# Add a light fixture on the top center of the roof
light = (
roof.faces(">Z")
.workplane(centerOption="CenterOfMass")
.circle(5) # Light fixture radius
.extrude(10) # Light fixture height
)
CadQuery does not directly support color, but you can add detailing or colorize in a downstream CAD viewer.
# Add raised lettering for "POLICE BOX" and other details as required